{extend name="public/audit" /}
{block name='body'}
<div class="layui-row" style="padding: 10px;">
    <div class="layui-col-md12 content detail">
        <div class="fly-panel detail-box">
            <h1>{$i.Title}</h1>
            <div class="fly-detail-info">

                {switch name='$i.Status'}
                {case value='已审核'} <span class="layui-badge">已审核</span> {/case}
                {case value='未审核'} <span class="layui-badge">未审核</span> {/case}
                {case value='已删除'} <span class="layui-badge">已删除</span> {/case}
                {
                {/switch}
                <span class="layui-badge layui-bg-green fly-detail-column"
                      title="资源分类">{$i['category']['Name']}</span>

                <!-- <span class="layui-badge" style="background-color: #5FB878;">已结</span> -->

                <span class="layui-badge layui-bg-green" title="分享时间">{$i.CreateTime}</span>
                <span title="所需金币"><img src="__IMG__/goldIcon.png" class="sw-money-icon">{$i.Price}</span>

                <div class="fly-admin-box" data-id="123">
                    <!--<span class="layui-btn layui-btn-xs jie-admin" type="del">修改</span>-->

                    <!--<span class="layui-btn layui-btn-xs jie-admin" type="set" field="stick" rank="1">删除</span>-->
                    <!-- <span class="layui-btn layui-btn-xs jie-admin" type="set" field="stick" rank="0" style="background-color:#ccc;">取消置顶</span> -->

                    <!-- <span class="layui-btn layui-btn-xs jie-admin" type="set" field="status" rank="0" style="background-color:#ccc;">取消加精</span> -->
                </div>
                <span class="fly-list-nums">
                    {if condition="$i.Status eq '未审核'"}
                        <button class="layui-btn layui-btn-danger sw-pass-api">通过审核</button>
                        <button class="layui-btn layui-btn-primary sw-delete-api">软删除</button>
                     {/if}
                    {if condition="$i.Status eq '已删除'"}
                         <button class="layui-btn layui-btn-primary sw-recover-api">恢复</button>
                     {/if}
                    {if condition="$i.Status eq '已审核'"}
                         <button class="layui-btn layui-btn-primary sw-delete-api">软删除</button>
                     {/if}



          </span>
            </div>

            <div class="detail-about">
                <a class="fly-avatar" href="../user/home.html">
                    <img src="__PUBLIC__/{$i['user']['Cover']}" alt="资源">
                </a>
                <div class="fly-detail-user">
                    <a href="../user/home.html" class="fly-link">
                        <cite>{$i['user']['Name']}</cite>
                        <i class="layui-badge fly-badge-vip">{$i['user']['Level']}</i>
                    </a>
                    <span>{$i['user']['CreateTime']}</span>
                </div>
                <div class="detail-hits" id="LAY_jieAdmin" data-id="123">
                    <span title="所需金币" title="拥有"><img src="__IMG__/goldIcon.png" class="sw-money-icon"> {$i['user']['Gold']} </span>
                </div>
            </div>

            <div class="detail-body photos sw-desc-content" id="resDesc">
                {$i.Desc}
            </div>
            {if condition="$i.Status eq '未审核'"}
            <button class="layui-btn layui-btn-danger sw-pass-api" style="width: 100%">通过审核</button>
            {else /}
            <button class="layui-btn layui-btn-danger sw-close" style="width: 100%">关闭</button>
            {/if}


        </div>
    </div>
</div>

{/block}
{block name='defaultScript'}
<script>
    layui.config({
        version: "1.0.0"
        , base: '__JS__/' //这里实际使用时，建议改成绝对路径
    }).extend({
        fly: 'index'
    }).use(['form', 'jquery', 'fly', 'face', 'jquery', 'res'], function ()
    {

        let form = layui.form, $ = layui.jquery, fly = layui.fly, response = layui.res;
        $('.sw-pass-api').click(function ()
        {
            $.get("{:url('audit/passRes')}?guid=" + "{$i.PK_ResourceGuid}", function (res)
            {
                response.modify(res);
            });
        });

        $('.sw-close').click(function ()
        {
            return parent.layer.close(parent.layer.getFrameIndex(window.name));
        });

        $('.sw-delete-api').click(function ()
        {
            return response.delete("{:url('audit/deleteResApi')}?guid= " + "{$i.PK_ResourceGuid}")
        });
        $('.sw-recover-api').click(function ()
        {
            $.get("{:url('audit/recoverResApi')}?guid= " + "{$i.PK_ResourceGuid}", function (res)
            {
                return response.modify(res);
            })
        });

//        内容转义
        {

            let obj = $('#resDesc');
            let html = obj.html();
            obj.html(fly.content(html));
        }
    });
</script>
{/block}